package com.hzcx.app.simplechat.util.map;


/**
 *  高德地图相关参数
 */
public class GdMapCommon {

    public static GdMapCommon gdMapCommon = null;

    public static GdMapCommon getInstance() {
        if (gdMapCommon == null) {
            gdMapCommon = new GdMapCommon();
        }
        return gdMapCommon;
    }

    private String lat;
    private String lng;
    private String city;

    public void startLocation() {
        GdMapUtils.getInstance().startLocation(aMapLocation -> {
            GdMapUtils.getInstance().stopLocation();
            if (aMapLocation == null || aMapLocation.getErrorCode() != 0) {
                lat = "";
                lng = "";
                city = "定位失败";
            } else {
                lat = aMapLocation.getLatitude() + "";
                lng = aMapLocation.getLongitude() + "";
                city = aMapLocation.getCity();
            }
        });
    }

    public String getLat(){
        return lat;
    }

    public String getLng(){
        return lng;
    }

    public String getCity(){
        return city;
    }
}
